The present invention relates to color image transfer processing apparatus and method, color image reconstruction processing apparatus and method, and a color image transfer system for compressing color image data of a full color space which is treated in a computer by a subtractive color pallet and for transferring the compressed data to equipment such as a printer or the like. More particularly, the invention relates to color image transfer processing apparatus and method, color image reconstruction processing apparatus and method, and a color image transfer system for compressing color image data by a subtractive color process using a subtractive color pallet every divided area of the color image data and for transferring the compressed data.
Hitherto, in a color image which is processed on a computer, with respect to an RGB display system as an example, the color image is expressed by 8 bits of each of color components of R, G, and B and color image data of a full color space of (256).times.(256).times.(256)=16,777,216 colors by combinations of R, G, and B is treated. When the full color image data is transferred as it is to an external apparatus such as a printer or the like, however, since one pixel consists of three bytes, there are problems such that an amount of data increases in proportional to three times of the number of pixels, a buffer capacity on the printer side increases, and it takes a longer time for data transfer. Consequently, a pallet transfer system (subtractive color processing system) for converting full color pixel data of three bytes into halftone data of one byte by using a LUT (look-up table) called a subtractive color pallet and for transferring the halftone data is used.
FIGS. 1A to 1C schematically show the pallet transfer system. FIG. 1A shows color image data 300 having the number (N) of color pixels of a full color space as a target to be transferred. The color image data 300 is constructed by (N) pixels in which each position is designated by (i) row and (j) column. For example, in the RGB space, one color pixel is constructed by pixel data of R, G, and B of three bytes. FIG. 1B shows a subtractive color pallet 302 which is used for transfer of the color image data 300 of FIG. 1A. The number of colors which can be simultaneously expressed in a color image is limited to representative colors of, for example, n=256 colors. That is, the subtractive color pallet 302 has 256 entries shown by entry numbers 001 to 256 and RGB pixel data of three bytes is stored as a representative color in each entry. There are two kinds of methods of determining the 256 representative colors: namely, a fixed dividing method of determining by dividing the RGB full color space into 256 spaces which are decided by a predetermined number of entries; and a variable dividing method of distributing pixels into the RGB full color space and dividing the RGB full color space into 256 spaces.
According to the fixed dividing method, as shown in FIG. 2, an RGB space 306 is preliminarily divided into 256 spaces. Specifically, the space division is determined by a combination of upper bits of 8-bit data of each of the color components of R, G, and B. For example, when each of the R axis and the G axis is divided into eight portions by using upper three bits of each of the R and G components and the B axis is divided into four portions by using upper two bits of the B component, the space can be divided into (8.times.8.times.4=) 256 spaces. When the space can be divided into the 256 spaces as mentioned above, representative color candidates are determined in consideration of a distribution of the RGB color pixels of FIG. 1A in the divided spaces, and an average value of the RGB representative color candidates existing in each divided space is obtained and is registered as a representative color in the subtractive color pallet 302 as shown in FIG. 1B. By forming the entries of the subtractive color pallet of FIG. 1B by upper three bits of each of the R and G components and upper two bits of the B component, it can be determined that the RGB color pixel belongs to which one of the divided space. That is, the 8-bit entry of an arbitrary RGB color pixel is constructed by the following bits.
bits b7 to b5=upper three bits of the R component PA1 bits b4 to b2=upper three bits of the G component PA1 bits b1 to b0=upper two bits of the B component PA1 256 entries: discrimination threshold value (B)=384+.alpha. PA1 128 entries: discrimination threshold value (B)=192+.alpha. PA1 64 entries: discrimination threshold value (B)=96+.alpha. PA1 32 entries: discrimination threshold value (B)=48+.alpha. PA1 the number of colors calculating step of counting the number (A) of colors as the number of different color pixel values while scanning pixels of color image data every row; PA1 a pallet forming step which has a storing area of representative colors of a predetermined number (n) of entries, sequentially stores the full color pixel values as representative colors into the entries each time the number (A) of colors is counted up, and forms a subtractive color pallet; PA1 a transfer format discriminating step of counting the number (N) of transfer pixels up to the end of the previous row when the number (A) of colors exceeds the number of entries of the subtractive color pallet, comparing a transfer data amount according to a full color format of the number (N) of transfer pixels with a transfer data amount according to a pallet format, and instructing data transfer according to the format of a smaller one of the transfer data amounts; and PA1 a data transfer step of forming and transferring pallet format data including halftone codes obtained by converting the color pixels to entry numbers of the subtractive color pallet and the representative colors of the subtractive color pallet when an instruction of the data transfer of the pallet format is received and forming and transferring the full color format data including the full color pixels as they are when an instruction of the data transfer of the full color format is received. PA1 a first boundary setting step of setting a fixedly determined first boundary for a color image, thereby dividing the color image into a plurality of areas; PA1 a color change detecting step of detecting a color change by retrieving each of the areas divided by the first boundary in a direction which perpendicularly crosses the boundary; PA1 a second boundary setting step of detecting a portion having no color change by the color change detecting step and setting a new second boundary; PA1 a code converting step of converting each color pixel value into a halftone code expressed by an entry number of a subtractive color pallet with respect to each of the areas divided by the setting of the second boundary; PA1 a pallet forming step of registering the color pixel values as representative color candidates into corresponding entries of the subtractive color pallet each time the color pixel value is converted into the code and determining a representative color every entry after completion of the code conversion; and PA1 a data transfer step of transferring the halftone code and the pallet representative color every area. PA1 a boundary area retrieving step of detecting a position having no color change as an area start position by retrieving one area on a row unit basis while setting the reception boundary which divides the reception color image expressed by the entry number to a start point, detecting a position having no color change as an area end position by retrieving the other area on a row unit basis while setting the same reception boundary to a start point, and setting a new boundary area including the reception boundary; PA1 a pallet forming step of forming a boundary subtractive color pallet of the newly set boundary area on the basis of two subtractive color pallets reconstructed from the reception data with respect to areas locating on both sides of the boundary; and PA1 a code reconstructing step of reconstructing a color image of the boundary area by converting the halftone code expressed by the entry number of the boundary area by using the boundary subtractive color pallet into the representative color. PA1 an image dividing step of dividing a color image into a plurality of areas at a desired row position; PA1 a weight setting step of setting a weight according to a distance from the boundary every area; PA1 a code converting step of converting a color pixel value of each pixel into a halftone code expressed by an entry number of the subtractive color pallet every area; PA1 a representative color candidate registering step of registering the color pixel value as a representative color candidate obtained by adding a weight to the color pixel value into an entry of the subtractive color pallet designated by the conversion code each time the color pixel value is converted into the code in the code converting step; PA1 a representative color determining step of determining a representative color so that the pixel near the boundary remains as a representative color on the basis of the weight from one or a plurality of candidates registered in each entry of the subtractive color pallet when the code conversion of the color pixels in all of the areas is finished; and PA1 a data transferring step of transferring the halftone code and the representative color of the subtractive color pallet every area. PA1 a pallet forming step of forming an optimum subtractive color pallet every plurality of areas obtained by dividing the color image; PA1 a color image correcting step of detecting errors between each color pixel value and the corresponding representative color of the subtractive color pallet every plurality of areas and distributing the errors to the peripheral pixels, thereby correcting each color pixel value so as to approach the representative color; PA1 a code converting step of converting each color pixel value corrected by distributing the errors into a halftone code expressed by the entry number of the subtractive color pallet; and PA1 a data transferring step of transferring the halftone code and the representative color of the subtractive color pallet every area.
When they are expressed by a decimal notation, they become the entry number in FIG. 1B. Consequently, the full color 3-byte RGB pixel data in FIG. 1A is converted to a halftone code 304 expressed by the 8-bit entry number in FIG. 1C by using upper three bits of each of the R and G components and the upper two bits of the B component and the halftone code 304 is transferred. Simultaneously, the representative colors corresponding to the 256 entries of the subtractive color pallet of FIG. 1B are also transferred as pallet representative colors, thereby enabling the subtractive color pallet to be reconstructed on the transfer destination side. In the transfer destination, the subtractive color pallet 302 as shown in FIG. 1B is reconstructed from the received representative colors and the RGB color pixel data of the representative color is reconstructed with reference to the subtractive color pallet 302 from the entry number as a halftone code in FIG. 1C which was simultaneously received. The data amount when the full color three-byte RGB data of (N) pixels is transferred is equal to (3.times.N) bytes. On the other hand, according to the pallet transfer, it is sufficient that the halftone data showing the entry consists of (N) bytes, which is 1/3 of the above data amount. Even when the data amount of (256.times.3=) 768 bytes of the 3-byte RGB data of the 256 representative colors of the pallet is added to (N) bytes, the data amount can be sufficiently reduced.
On the other hand, according to the variable dividing method of determining the representative colors of the subtractive color pallet, the distribution of (N) color pixels in FIG. 1A in the RGB space 306 in FIG. 2 is considered and the color space is divided into two equal spaces so that the numbers of distributed pixels are equal. The dividing operation is finished at a time point when the dividing number is equal to 256 as the number of entries, and the average value of the RGB color pixels existing in each divided space is obtained and is registered as a representative color into the subtractive color pallet. The determination of the representative colors by the variable dividing method is preferable from a viewpoint that the size of each divided space dynamically changes according to the contents of the color image data which is transferred and the representative color that is closer to the original color can be reconstructed. However, it takes a long processing time to divide the space when the representative colors are decided. When one subtractive color pallet is formed for the whole color image data as a target and the color image data is converted to the halftone data and is transferred, the differences between the original color image and the representative colors of the subtractive color pallet are relatively large and there is a case where reproducibility of a reconstructed color image by the representative colors obtained from the halftone data with reference to the pallet is not so good. Therefore, the color image data 300 is divided into a plurality of areas #1 to #6 in the row direction as shown in FIG. 3, a subtractive color pallet is formed every one of the divided areas #1 to #6, and the color image data 300 is converted to a halftone code which is expressed by the representative color and the entry number and is transferred, thereby improving the reproducibility of the color image on the transfer destination side.
In the pallet transfer system according to such an area division, a color deviation in each area can be expressed and the reproducibility of the color is improved as compared with that in case of selecting the representative color in the whole image data. Since the subtractive color pallet is formed by selecting the representative color every area, however, there are problems such that even in case of the same color, the representative color differs every area, and even if the same color is used in two areas before and after the boundary of the areas, when the color image is reconstructed by the representative colors from the halftone codes, a color deviation occurs at the area boundary.